package cn.tedu.boot.demo.util;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;

import java.nio.charset.StandardCharsets;

//解耦
@Component
public class GlobalPasswordEncoder {

  @Autowired
  private PasswordEncoder passwordEncoder;

    /**
     * 执行加密
     * @param rawPassword 明文密码（原文）
     * @return 密文密码（加密后的结果）
     */

    public  String encode(String rawPassword){
        return passwordEncoder.encode(rawPassword);
    }

}
